home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / QCKSRT.DEM < prev    next >
Text File  |  1991-04-29  |  799b  |  41 lines

  1. PROGRAM d8r8(input,output,dfile);
  2. (* driver for routine QCKSRT *)
  3. CONST
  4.    np = 100;
  5. TYPE
  6.    glarray = ARRAY [1..np] OF real;
  7. VAR
  8.    i,j : integer;
  9.    a : glarray;
  10.    dfile : text;
  11.  
  12. (*$I MODFILE.PAS *)
  13. (*$I QCKSRT.PAS *)
  14.  
  15. BEGIN
  16.    glopen(dfile,'tarray.dat');
  17.    readln(dfile);
  18.    FOR i := 1 to 100 DO BEGIN
  19.       read(dfile,a[i])
  20.    END;
  21.    close(dfile);
  22. (* print original array *)
  23.    writeln('original array:');
  24.    FOR i := 1 to 10 DO BEGIN
  25.       FOR j := 1 to 10 DO BEGIN
  26.          write(a[10*(i-1)+j]:6:2)
  27.       END;
  28.       writeln
  29.    END;
  30. (* writeln sorted array *)
  31.    qcksrt(np,a);
  32.    writeln;
  33.    writeln ('sorted array:');
  34.    FOR i := 1 to 10 DO BEGIN
  35.       FOR j := 1 to 10 DO BEGIN
  36.          write(a[10*(i-1)+j]:6:2)
  37.       END;
  38.       writeln
  39.    END
  40. END.
  41.